package org.cloud.mall.project.controller;

import lombok.RequiredArgsConstructor;
import org.cloud.mall.common.utils.poi.ExcelUtil;
import org.cloud.mall.framework.aspectj.lang.annotation.Log;
import org.cloud.mall.framework.aspectj.lang.enums.BusinessType;
import org.cloud.mall.project.domain.SlEntryHeadListShangjian;
import org.cloud.mall.framework.web.domain.AjaxResult;
import org.cloud.mall.project.service.ISlEntryHeadListShangjianService;
import org.cloud.mall.framework.web.controller.BaseController;
import org.cloud.mall.framework.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * 报关表头表体Controller
 * <p>
 *     资源必须以为复数结尾
 * </p>
 * @author qianjing
 * @date 2023-03-21
 */
@RestController
@RequestMapping("/entryHeadListShangjians")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class SlEntryHeadListShangjianController extends BaseController {

    private final ISlEntryHeadListShangjianService slEntryHeadListShangjianService;

    /**
     * 查询报关表头表体列表
     */
    @GetMapping("/list/v1")
    @Log(title = "报关表头表体", businessType = BusinessType.EXPORT)
    public TableDataInfo list(SlEntryHeadListShangjian slEntryHeadListShangjian) {
        startPage();
        List<SlEntryHeadListShangjian> list = slEntryHeadListShangjianService.selectSlEntryHeadListShangjianList(slEntryHeadListShangjian);
        return getDataTable(list);
    }

    /**
     * 导出报关表头表体列表
     */
    @Log(title = "报关表头表体", businessType = BusinessType.EXPORT)
    @GetMapping("/export/v1")
    public AjaxResult export(SlEntryHeadListShangjian slEntryHeadListShangjian) {
        List<SlEntryHeadListShangjian> list = slEntryHeadListShangjianService.selectSlEntryHeadListShangjianList(slEntryHeadListShangjian);
        ExcelUtil<SlEntryHeadListShangjian> util = new ExcelUtil<SlEntryHeadListShangjian>(SlEntryHeadListShangjian.class);
        return util.exportExcel(list, "报关表头表体数据");
    }

}
